<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Jialeo\LaravelSchemaExtend\Schema;

class CreateOpenShopIntendedSiteLocation extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('open_shop_intended_site_selection', function (Blueprint $table) {
            $table->id();

            $table->unsignedBigInteger("shopId")->default(0)->comment("门店id");
            $table->string("poiName", 120)->comment("poi名称")->default("");
            $table->string("poiAddress", 180)->comment("poi地址")->default("");

            $table->string("provinceCode", 12)->comment("省份")->default("");
            $table->string("cityCode", 12)->comment("城市")->default("");
            $table->string('districtCode', 12)->default("")->comment('区code');
            $table->string("addressPrefix", 88)->comment("意向区域前缀")->default("");

            $table->string("longitude", 64)->comment("经度")->default("");
            $table->string("latitude", 64)->comment("纬度")->default("");
            $table->string("siteSelectionImg", 120)->comment("选址封面图")->default("");


            $table->unsignedInteger('createdAt')->default(0)->comment('创建时间');
            $table->unsignedInteger('createdByUid')->default(0)->comment('创建人');
            $table->unsignedInteger('updatedAt')->default(0)->comment('修改时间');
            $table->unsignedInteger('updatedByUid')->default(0)->comment('修改人');

            $table->tinyInteger('isDeleted')->default(0)->comment('是否删除 0 否 1 是');
            $table->collation = 'utf8mb4_general_ci';
            $table->comment   = '意向选址表';

            $table->index(['shopId', 'createdByUid'], 'idx_shopId_createdByUid');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('open_shop_intended_site_selection');
    }
}
